//2009/08/08 15:00:11
//2009/09/01 23:52:48
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>

using namespace std;

class PartySeats
{
public:
    vector <string> seating(vector <string> attendees)
    {
		int N = attendees.size();
		vector<string> v1; 	//boy;
		vector<string> v2;	//girl;
		vector<string> ret;
		for(int i=0; i<N; i++)
		{
			stringstream ss(attendees[i]);
			string s1, s2;
			ss >> s1 >> s2;
			if(s2 == "boy") v1.push_back(s1);
			if(s2 == "girl") v2.push_back(s1);
		}
		sort(v1.begin(), v1.end());
		sort(v2.begin(), v2.end());
		
		if(v1.size() != v2.size() || v1.size() %2 !=0 || v2.size() %2 !=0 || v1.size() < 2 || v2.size() < 2) return ret;
		ret.push_back("HOST");
		
		for(int i=v1.size()/2; i>0; i--)
		{
			ret.push_back(v2[0]);
			v2.erase(v2.begin());
			ret.push_back(v1[0]);
			v1.erase(v1.begin());
		}
		ret.push_back("HOSTESS");
		for(int i=v1.size(); i>0; i--)
		{
			ret.push_back(v1[0]);
			v1.erase(v1.begin());
			ret.push_back(v2[0]);
			v2.erase(v2.begin());
		}
		return ret;
    }
};
